/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

import React from 'react';
import styles from './status.less';

interface StatusProps {
  value: number;
}
interface StatusOptionsItem {
  value: '0' | '1' | '2' | '3' | 'all';
  label: string;
  color?: 'green' | 'orange';
}

const statusOptions: StatusOptionsItem[] = [
  { value: '0', label: '待领取', color: 'orange' },
  { value: '1', label: '已领取', color: 'green' },
  { value: '2', label: '已撤销' },
  { value: '3', label: '已过期', color: 'orange' },
];

const Status: React.FC<StatusProps> = (props) => {
  const { value } = props;
  const { label, color } = statusOptions[value] || {};
  if (label) {
    return <span className={styles[`color-${color}`]}>{label}</span>;
  }
  return null;
};

export function createStatusOptions() {
  return [{ value: 'all', label: '全部' }].concat(statusOptions);
}

export default Status;
